Skip to content

Conversation

mkmeral
Copy link
Contributor

@mkmeral mkmeral commented Sep 25, 2025

Description

This PR documents the new multi-agent shared state feature that allows passing invocation_state to Graph and Swarm patterns. The feature enables sharing configuration, credentials, and context data across all agents in multi-agent patterns without exposing this information to the LLM.

Type of Change

  • New content addition
  • Content update/revision
  • Structure/organization improvement
  • Typo/formatting fix
  • Bug fix
  • Other (please describe):

Motivation and Context

Following the implementation of PR #816 in the SDK, this documentation update is needed to help developers understand how to use the new invocation_state parameter with multi-agent patterns. The feature addresses a key customer need for sharing configuration and credentials across agents while maintaining proper separation of concerns.

The original SDK PR introduced kwargs support to Graph and Swarm, allowing developers to pass shared state that gets propagated to all agents, tools, and hooks without being visible in LLM prompts.

Areas Affected

  • Multi-agent documentation:
    • docs/user-guide/concepts/multi-agent/graph.md - Added "Shared State" section
    • docs/user-guide/concepts/multi-agent/swarm.md - Added "Shared State" section
  • Tools documentation:
    • docs/user-guide/concepts/tools/python-tools.md - Added "Accessing Invocation State in Tools" section
  • Hooks documentation:
    • docs/user-guide/concepts/agents/hooks.md - Added "Accessing Invocation State in Hooks" section

Screenshots

N/A - Documentation changes only

Checklist

  • I have read the CONTRIBUTING document
  • My changes follow the project's documentation style
  • I have tested the documentation locally using mkdocs serve
  • Links in the documentation are valid and working
  • Images/diagrams are properly sized and formatted
  • All new and existing tests pass

Additional Notes

This documentation covers three key integration points for the shared state feature:

  1. Multi-agent patterns (Graph/Swarm): How to pass invocation_state and what gets propagated
  2. Tools: How to access shared state via ToolContext.invocation_state
  3. Hooks: How to access shared state in tool-related hook events

The documentation emphasizes the important distinction between:

  • Shared Context: Information visible to LLMs for collaboration
  • Shared State: Hidden configuration passed via invocation_state

Cross-references between sections help developers understand the complete integration story across the framework.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mkmeral mkmeral enabled auto-merge (squash) September 25, 2025 18:19
zastrowm and others added 3 commits October 1, 2025 13:35
In strands-agents/sdk-python/pull/926 we've released these hooks (and done a rename) so update the docs to account for it

Part of strands-agents/sdk-python#667

Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
@mkmeral mkmeral merged commit e9ec4be into strands-agents:main Oct 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants